﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using ElectronicJournal.Account;

namespace ElectronicJournal
{
    public partial class Reviewer : System.Web.UI.Page
    {
        DataTable ArticleTable = new DataTable();
        private List<Publication> _publicationsForReviewer;
        private Reviewer _reviewer;


        protected void Page_Load(object sender, EventArgs e)
        {
            GridViewArticleReview.DataSource = ArticleTable;
            ArticleTable.Columns.Add("NameArticle", typeof(string));
            ArticleTable.Columns.Add("NameJournal", typeof(string));
            ArticleTable.Columns.Add("URLArticle", typeof(string));
            ArticleTable.Columns.Add("URLNewReview", typeof(string));
            GridViewArticleReview.DataBind();


            _reviewer =EJournalRepository.Instance.GetReviewerByUserId(
                 Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));
            _publicationsForReviewer = EJournalRepository.Instance.GetAllPubForReviewer(_reviewer.ReviewerId);

        }


        protected void GridViewArticleReview_Load(object sender, EventArgs e)
        {
            foreach (var pub in _publicationsForReviewer)
            {
                ArticleTable.Rows.Add(pub.TitleRussian, "назв журнала(Обновить Linq)", pub.FileArticle, @"~\NewReview.aspx"); //+ "?ArticleId=" + pub.Id);
                 GridViewArticleReview.DataBind();
            }

        }
    }
}